package net.wofly.sale.schedule;

import net.wofly.sale.order.OrderConfig;
import net.wofly.sale.order.service.ISaleOrderService;
import net.wofly.sale.order.service.impl.SaleOrderServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class OrderTimeoutRefreshSchedule {
    
    private static final Logger logger = LoggerFactory.getLogger(OrderTimeoutRefreshSchedule.class);
    
    @Autowired
    private OrderConfig config ;
    
    @Autowired
    private SaleOrderServiceImpl orderService;
    
    @Scheduled(cron = "${order.timeoutRefreshCron}")
    public void orderTimeoutRefresh() {
        try {
            logger.info(">>> 开始执行 订单超时 刷新 定时任务");
            orderService.orderTimeoutRefresh();
        } catch (Exception e) {
            logger.error(">>> 订单时效刷新定时任务 执行失败：", e);
        }
        logger.info(">>> 结束执行 订单超时 刷新 定时任务");
    }
    
}
